import { useMemo } from 'react';

/**
 * @description useActiveKeys 获取折叠面板所有 key
 * @param schemas 折叠面板内容数据项
 * @return activeKeys 折叠面板所有 key
 */
export function useActiveKeys({ schemas }: { schemas: CollapseFormAPI.SchemasProps[] }) {
  const activeKeys = useMemo(() => {
    const tempData: string[] = [];
    schemas.map((item: CollapseFormAPI.SchemasProps) => {
      tempData.push(item.key);
    });
    return tempData;
  }, [schemas]);

  return {
    activeKeys,
  };
}
